﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace project1113.FSM
{
    public class Fsm
    {
        public FsmState CurrentState { get; private set; }
        public Fsm(FsmState startState)
        {
            CurrentState = startState;
        }
        public void RunOnece()
        {
            FsmState lastState = CurrentState;
            CurrentState = CurrentState.GetNextState();
            if (lastState != CurrentState)
            {
                CurrentState.Init();
            }
            CurrentState.DoSomething();
        }

    }
}